package com.weixiao.enums;


import lombok.AllArgsConstructor;
import lombok.Getter;


/**
 * author 韩诚
 * date 2022/10/27 10:58
 */
@Getter
@AllArgsConstructor
public enum UserStatusEnum {


    NORMAL(1, "正常"),
    LOCK(0, "锁定");

    private final int code;
    private final String desc;

    public static String getDescByCode(Integer code) {
        UserStatusEnum[] yesOrNoEnums = UserStatusEnum.values();
        for (UserStatusEnum yesOrNoEnum : yesOrNoEnums) {
            if (yesOrNoEnum.getCode() == code) {
                return yesOrNoEnum.getDesc();
            }
        }
        return null;
    }
}
